package cn.cs.service;

import cn.cs.mapper.AgentShopMapper;
import cn.cs.pojo.Agent;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
public class AgentShopService {
    @Resource
    private AgentShopMapper agentShopMapper;

    @RequestMapping(value = "/getShopByAgentId", method = RequestMethod.POST)
    Map<String,Object> getShopByAgentId(@RequestParam("id")String id){
        return  agentShopMapper.getShopByAgentId(id);
    }
    @RequestMapping(value = "/updateAgentShopById", method = RequestMethod.POST)
    int updateAgentShopById(@RequestBody Map<String, Object> map){
        return  agentShopMapper.updateAgentShopById(map);
    }
    @RequestMapping(value = "/getTOdayEar", method = RequestMethod.POST)
    String getTOdayEar(@RequestParam("id")String id){
        return  agentShopMapper.getTOdayEar(id);
    }
    @RequestMapping(value = "/getOrderList", method = RequestMethod.POST)
    List<Map<String,Object>> getOrderList(@RequestBody Map<String, Object> param){
        return  agentShopMapper.getOrderList(param);
    }
    @RequestMapping(value = "/getProsByOrderId", method = RequestMethod.POST)
    List<Map<String,Object>> getProsByOrderId(@RequestParam("orderId")String orderId){
        return  agentShopMapper.getProsByOrderId(orderId);
    }
    @RequestMapping(value = "/doSendOrderById", method = RequestMethod.POST)
    int doSendOrderById(@RequestBody Map<String, Object> order){
        return  agentShopMapper.doSendOrderById(order);
    }
    @RequestMapping(value = "/getTodayAssets", method = RequestMethod.POST)
    String getTodayAssets(@RequestParam("id")String id){
        return  agentShopMapper.getTodayAssets(id);
    }
    @RequestMapping(value = "/getSetAssets", method = RequestMethod.POST)
    String getSetAssets(@RequestParam("id")String id){
        return  agentShopMapper.getSetAssets(id);
    }
    @RequestMapping(value = "/getAllAssets", method = RequestMethod.POST)
    String getAllAssets(@RequestParam("id")String id){
        return  agentShopMapper.getAllAssets(id);
    }
    @RequestMapping(value = "/getsetList", method = RequestMethod.POST)
    List<Map<String,Object>> getsetList(@RequestParam("id")String id){
        return  agentShopMapper.getsetList(id);
    }
    @RequestMapping(value = "/getAssetsList", method = RequestMethod.POST)
    List<Map<String,Object>> getAssetsList(@RequestBody Map<String, Object> param){
        return  agentShopMapper.getAssetsList(param);
    }
    @RequestMapping(value = "/getPolicy", method = RequestMethod.POST)
    List<Map<String,Object>> getPolicy(){
        return  agentShopMapper.getPolicy();
    }
    @RequestMapping(value = "/getLastSettlement", method = RequestMethod.POST)
    Map<String,Object> getLastSettlement(@RequestParam("id")String id){
        return  agentShopMapper.getLastSettlement(id);
    }
    @RequestMapping(value = "/getAgentById", method = RequestMethod.POST)
    Map<String,Object> getAgentById(@RequestParam("id")String id){
        return  agentShopMapper.getAgentById(id);
    }
    @RequestMapping(value = "/getSetMoney", method = RequestMethod.POST)
    String getSetMoney(@RequestBody Map<String, Object> param){
        return  agentShopMapper.getSetMoney(param);
    }
    @RequestMapping(value = "/getProSet", method = RequestMethod.POST)
    Map<String,Object> getProSet(){
        return  agentShopMapper.getProSet();
    }
    @RequestMapping(value = "/insertAgentSet", method = RequestMethod.POST)
    int insertAgentSet(@RequestBody Map<String, Object> setMap){
        return  agentShopMapper.insertAgentSet(setMap);
    }
    @RequestMapping(value = "/getSetOrderList", method = RequestMethod.POST)
    List<Map<String,Object>> getSetOrderList(@RequestBody Map<String, Object> param){
        return  agentShopMapper.getSetOrderList(param);
    }
    @RequestMapping(value = "/insertSetOrder", method = RequestMethod.POST)
    int insertSetOrder(@RequestBody Map<String, Object> setOrderMap){
        return  agentShopMapper.insertSetOrder(setOrderMap);
    }
    @RequestMapping(value = "/getOrderCount", method = RequestMethod.POST)
    Map<String,Object> getOrderCount(@RequestParam("id")String id){
        return  agentShopMapper.getOrderCount(id);
    }

    @RequestMapping(value = "/getAgentNumberByAgentId", method = RequestMethod.POST)
    public Long getAgentNumberByAgentId(@Param(value = "invitationCode") String invitationCode, @Param(value = "list")List<Agent> list) throws Exception{
        return agentShopMapper.getAgentNumberByAgentId(invitationCode, list);
    }

}
